#modeltag({tagcode:"jxbrms_systemdict",id:params[0]})
#include("/common/layout/bootstrap_form_layout.html")
#@layout()

#define title()
#(jxrb.message(actionName,"systemDict"))
#end

#define head()
<script>
  seajs.use(["jquery","jx_msgbox","jx_pinyin","jac","jx_check"],function($,msgbox,jxpy)
  {
    $(function()
    {
      jxpy({nameObject:"#dictName",codeObject:"#dictCode"}) ;
    });
    $("#b_submit").on("click", function ()
    {
      if (!jxCheck.check())
        return false;
      msgbox.confirm({url:"#(controllerKey)#(action)/"},
      function()
      {
        msgbox.close();
        if (msgbox.messageType != 2)
          clearForm();
      },function()
      {
        if (msgbox.messageType != 2)
          location.href = "#(controllerKey)";
      });
    });
    
    $("#b_return").on("click", function ()
      {
        returnInfo();
      });   
      
    function returnInfo()
    {
      location.href = "#(controllerKey)";
    }

    function clearForm()
    {
      #if ((action ??) == "added")
        $("#dictCode").val("");
        $("#dictName").val("");
      #end
    }

    function setViewNum(id)
    {
      $.ajax({
        url:"#(jxwebpath.item)service/dict/viewNum/" + id + "-" + $("#dicttype").val() ,
        dataType: "text",
        success: function(data) 
        {
          $("#viewNum").val(data);
        }            
      });
    }
    
    #if ((action ??) == "added")
        setViewNum("") ;
    #end
    
    function jx_auto_select_func(curObject,jsonObject)
    {
      if($(curObject).attr("jac_id") == "dicttype")
        setViewNum("") ;
      else
        setViewNum($("#" + $(curObject).attr("jac_id")).val()) ;
    }
    window.jx_auto_select_func = jx_auto_select_func ;
    
  });
</script>
#end

#define bodyExt()
class="gray-bg"
#end

#define form()
#include("info.html")
#end

#define formAfter()
        <center>
            #jx_button({value:"action.save"})&nbsp;&nbsp;&nbsp;&nbsp;
            #jx_button({value:"action.return",id:"b_return"})
        </center>
#end